﻿@page "/DataSource/MqttStorage"
<PageTitle>MQTT数据源配置</PageTitle>
@inherits ComponentBaseDataCenter

<div>

    <h3>MQTT存储配置</h3>

    <Table TItem="MqttStoragVO" UseInjectDataService="false" IsPagination="true" PageItemsSource="PageItems" DoubleClickToEdit="true"
           IsStriped="true" IsBordered="true" ShowSkeleton="true" IsMultipleSelect="true" ShowEmpty="true" ShowLoading="true" ShowColumnList="true"
           ShowToolbar="true" ShowExtendButtons="true"
           ShowSearch="true" ShowAdvancedSearch="false"
           AutoGenerateColumns="false" EditMode="EditMode.Popup"
           OnQueryAsync="QueryAsync" OnSaveAsync="@OnSaveAsync" OnDeleteAsync="OnDeleteAsync" ShowToastAfterSaveOrDeleteModel="false">
        <EditTemplate>
            <div class="row g-3 form-inline">
                <div class="col-12 col-sm-12">
                    <Select @bind-Value="@context.MqttTopicID" Items="@TopicItems" placeholder="不可为空，50字以内" ShowSearch="true" />
                </div>
                <div class="col-12 col-sm-12">
                    <BootstrapInput @bind-Value="@context.TaskConfigView" placeholder="请输入连接字符串" />
                    <Button Text="流程配置" IsAsync="true" OnClick="@(()=>OnConfigClickAsync(@context))"></Button>
                </div>
            </div>
        </EditTemplate>
        <TableColumns>
            <TableColumn Sortable="true" Filterable="true" Searchable="true" @bind-Field="@context.Topic.Name" />
            <TableColumn @bind-Field="@context.Topic.Topic" />
            <TableColumn @bind-Field="@context.TaskConfigView" Width="300" ShowTips="true" TextEllipsis="true" />
        </TableColumns>
        <RowButtonTemplate>
            @*<TableCellButton Color="Color.Info" Icon="fa-solid fa-pen" Text="测试连接" OnClick="@(()=>OnConnTestAsync(context))" />*@
            @*<TableCellPopconfirmButton Color="Color.Info" Icon="fa-solid fa-pen" Text="测试" />*@
        </RowButtonTemplate>
        @*<TableColumns>
        <TableColumn @bind-Field="@context.Hobby" Items="GetHobbys(context)" />
        </TableColumns>*@
    </Table>

</div>